package com.treegames.rpghelper;

import java.io.Serializable;

import com.treegames.rpghelper.R;
import com.treegames.rpghelper.enums.EJobs;
import com.treegames.rpghelper.enums.ERaces;
import com.treegames.rpghelper.sheet.CharacterPlayer;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;

public class ScreenMain extends Activity {
	

	@Override
	public void onCreate(Bundle savedInstanceState) {
		final Spinner spnJobs;
		final Spinner spnRaces;	
		super.onCreate(savedInstanceState);
		setContentView(R.layout.lay_screen_main);

		spnJobs = (Spinner) findViewById(R.spinner.job);
		spnJobs.setAdapter(new ArrayAdapter<EJobs>(this,
				android.R.layout.simple_spinner_item, EJobs.values()));
		spnRaces = (Spinner) findViewById(R.spinner.race);
		spnRaces.setAdapter(new ArrayAdapter<ERaces>(this,android.R.layout.simple_spinner_item, ERaces.values()));

		Button nextButton = (Button) findViewById(R.button.next);

		nextButton.setOnClickListener(new View.OnClickListener() {

			public void onClick(View view) {
				
				CharacterPlayer sheet = ((ERaces) spnRaces.getSelectedItem()).getRace();
				sheet.setName("Thiago");
				//sheet.getJobList().add(((EJobs) spnJobs.getSelectedItem()).getJob());
				sheet.levelUp(((EJobs) spnJobs.getSelectedItem()).getJob());
				Intent intent = new Intent(ScreenMain.this, ScreenStats.class);
				//Bundle params = new Bundle();
				intent.putExtra("sheet", sheet);
				//params.putSerializable("sheet", (Serializable) sheet);
				//intent.putExtras(params);
				startActivity(intent);
			}

		});
	}

}
